package com.liu.QQ.client.service;

import java.util.HashMap;

/**
 * 管理客户端连接到服务端的线程类
 * @author liuchengjie
 */
public class ManageClientConnectThread {
    /**
     * 将多个线程放入集合中，key是用户id,value是线程
     */
    private static HashMap<String, ClientConnectThread> manage = new HashMap<>();

    /**
     * 添加连接线程
     * @param userId
     * @param connectThread
     */
    public static void addThreadToManage(String userId, ClientConnectThread connectThread) {
        manage.put(userId, connectThread);
    }

    /**
     * 获取连接线程
     * @param userId
     * @return
     */
    public static ClientConnectThread getConnectThread(String userId) {
        ClientConnectThread clientConnectThread = manage.get(userId);
        return clientConnectThread;
    }
}
